home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / utilities / shell / execute_upd.lha / Execute / strsep.1 < prev    next >
Encoding:
Text File  |  1995-02-28  |  1.2 KB  |  67 lines

  1.  
  2. STRSEP(3)                  UNIX Programmer's Manual                  STRSEP(3)
  3.  
  4. NAME
  5.      strsep - separate strings
  6.  
  7. SYNOPSIS
  8.      #include <string.h>
  9.  
  10.      char *
  11.      strsep(char **stringp, char *delim)
  12.  
  13. DESCRIPTION
  14.      The strsep() locates in the null­terminated string at *stringp the first
  15.      occurence of any character in delim and replaces this with a `\0',
  16.      records the location of the immediate following character in *stringp,
  17.      then returns the original value of *stringp. If no delimiter characters
  18.      are found, strsep() sets *stringp to NULL; if *stringp is initially NULL,
  19.      strsep() returns NULL.
  20.  
  21. EXAMPLES
  22.      The following uses strsep() to parse strings containing runs of white
  23.      space, making up an argument vector:
  24.  
  25.            char inputstring[100];
  26.            char **argv[51], **ap = argv, *p, *val;
  27.            /* set up inputstring */
  28.            for (p = inputstring; p != NULL; ) {
  29.                    while ((val = strsep(&p, " \t")) != NULL && *val == '\0');
  30.                    *ap++ = val;
  31.            }
  32.            *ap = 0;
  33.  
  34. HISTORY
  35.      The strsep() function is currently under development.
  36.  
  37. BSD Experimental                April 19, 1991                               1
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.